﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using JM.JCY.Common;
using JM.JCY.Proxy;
using JM.JCY.BusinessEntity;
using NCS.IConnect.ApplicationContexts;

namespace JM.JCY.SharePointComponent.PerformanceArchives.CreateLiangHuaStatistics
{
    public partial class CreateLiangHuaStatisticsUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {


            }
        }

        protected void imgSubmit_Click(object sender, ImageClickEventArgs e)
        {
            using (PerformanceCaseProxy proxy = new PerformanceCaseProxy())
            {
                var newDT = new PerformanceCaseDataSet.T_LiangHuaStatisticsDataTable();
                var newRow = newDT.NewT_LiangHuaStatisticsRow();
                newRow.Year = this.txtYear.Text;
                newRow.Dept = this.txtDept.Text;
                newRow.Name = this.txtName.Text;
                newRow.Position = this.txtPosition.Text;
                newRow.Rank = this.txtRank.Text;
                newRow.BasicScore = this.txtBasicScore.Text;
                newRow.StressRate = this.txtStressRate.Text;
                newRow.Addition_Position = this.txtAdditionPosition.Text;
                newRow.Addition_Dept = this.txtAdditionDept.Text;
                newRow.Addition_Others = this.txtAdditionOthers.Text;
                newRow.Minus_Performance = this.txtMinusPerformance.Text;
                newRow.Minus_Quality = this.txtMinusQuality.Text;
                newRow.Minus_Count = this.txtMinusCount.Text;
                newRow.Minus_Info = this.txtMinusInfo.Text;
                newRow.Total = this.txtTotal.Text;
                JCYUtility.UpdateCommonFields(newRow, "Iori");

                newDT.AddT_LiangHuaStatisticsRow(newRow);
                proxy.UpdateLiangHuaStatistics(newDT);
                Response.Redirect("LiangHuaStatistics.aspx");

            }

        }

        protected void imgCancel_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("LiangHuaStatistics.aspx");

        }
    }
}
